package com.borrower.action;



public class ActionFactory {

    public static final String LOGIN = "login";
    public static final String REGIS = "regis";

    public static final String AJAX_RETURN_BOR_INFO = "ajaxReturnBorInfo";
    public static final String AJAX_RETURN_BOOK_INFO = "ajaxReturnBookInfo";
    public static final String USER_SEND_MSG= "user_send_msg";


    public static final String REGISNAME="regisName";//判断注册时用户名是否重复
    public static final String BORROWINFO="borrowInfo";//用户借阅订单
    public static final String USERINFO="userInfo";//显示用户个人信息
    public static final String CANCEL="cancel";//将用户注销状态设置为1
    public static final String EXIT="exit";//退出



    public static final String BOOKDAMAGEINFO="BookDamageInfo";//提交书籍报损




    private ActionFactory() {
    }

    public static Action createAction(String type) {
        Action action = null;
//        type=
        if (type.equals(LOGIN)) {
            action = new LoginAction();
        } else if (type.equals(REGISNAME)) {
            action = new RegisNameAction();
        } else if (type.equals(REGIS)) {
            action = new RegisAction();
        } else if (type.equals(AJAX_RETURN_BOR_INFO)) {
            action = new AjaxReturnBorInfoAction();
        } else if (type.equals(AJAX_RETURN_BOOK_INFO)) {
            action = new AjaxReturnBookInfoAction();
        }else if(type.equals(USER_SEND_MSG)){
            action = new BorrowerMsg();
        }else if (type.equals(BORROWINFO)){
            action = new BorrowInfoAction();
        }else if (type.equals(USERINFO)){
            action = new UserInfoAction();
        }else if (type.equals(CANCEL)){
            action = new CancelAction();
        } else if (type.equals(EXIT)){
            action = new ExitAction();
        }else if (type.equals(BOOKDAMAGEINFO)){
            action = new BookDamageInfoAction();
        }

        return action;
    }
}

